package com.tarena.lbs.user.dao.repository.impl;

import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.tarena.lbs.user.dao.mapper.UserGroupMapper;
import com.tarena.lbs.user.dao.repository.UserGroupRepository;
import com.tarena.lbs.user.pojo.po.UserGroupPO;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Repository;
;import java.util.List;

@Repository
public class UserGroupRepositoryImpl implements UserGroupRepository {
    @Autowired
    private UserGroupMapper userGroupMapper;
    @Override
    public Long count(UserGroupPO userGroupPO) {
        QueryWrapper queryWrapper=new QueryWrapper();
        queryWrapper.eq("business_id",userGroupPO.getBusinessId());
        queryWrapper.eq("group_name",userGroupPO.getGroupName());
        return userGroupMapper.selectCount(queryWrapper);
    }

    @Override
    public void save(UserGroupPO po) {
        userGroupMapper.insert(po);
    }

    @Override
    public List<UserGroupPO> pageList(QueryWrapper<UserGroupPO> queryWrapper) {
        return userGroupMapper.selectList(queryWrapper);
    }
}
